package com.jkoss.dao.stu;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import com.jkoss.pojo.stu.Ossstu;
import com.jkoss.pojo.stu.OssstuExample;
import com.jkoss.tool.Page;

public interface OssstuMapper {
	
	@Select("select a.ossstuid  from t_ossstu a,t_classes b, t_consultation c where a.clzid = b.clzid and c.ossstuid = a.ossstuid and c.stuname=#{stuname} and  b.clzname=#{clzname}")
	@ResultType(java.lang.Integer.class)
	Integer findStuIdByName_clsName(@Param("stuname") String stuname,@Param("clzname")  String clzname);
	
	@Select("SELECT t_consultation.stuname FROM t_consultation INNER JOIN t_ossstu ON t_consultation.ossstuid = t_ossstu.ossstuid and  t_ossstu.ossstuid=#{ossstuid}")
	@ResultType(java.lang.String.class)
	String findStuNameByStuid(@Param("ossstuid") Integer ossstuid);
	
    int countByExample(OssstuExample example);

    int deleteByExample(OssstuExample example);

    int deleteByPrimaryKey(Integer ossstuid);

    int insert(Ossstu record);

    int insertSelective(Ossstu record);

    List<Ossstu> selectByExample(OssstuExample example);

    Ossstu selectByPrimaryKey(Integer ossstuid);

    int updateByExampleSelective(@Param("record") Ossstu record, @Param("example") OssstuExample example);

    int updateByExample(@Param("record") Ossstu record, @Param("example") OssstuExample example);

    int updateByPrimaryKeySelective(Ossstu record);

    int updateByPrimaryKey(Ossstu record);

	List<Ossstu> selectByPageClaid(Page<Ossstu> page);
	
	@Select("UPDATE t_ossstu SET clzid=${clzid },stustate=1 WHERE ossstuid=${stuid}")
	void updateByStuidClzid(@Param("stuid")String stuid, @Param("clzid")Integer clzid);
	
	
	int insertOssstu(@Param("ossstu") Ossstu ossstu,@Param("zxstuid") int zxstuid);

	@Select("select * from t_ossstu where stuname=#{stuname} and stucellphone=#{stucellphone}")
	@ResultMap("com.jkoss.dao.stu.OssstuMapper.BaseResultMap")
	Ossstu selectByNamePhone(@Param("stuname")String stuname, @Param("stucellphone")String stucellphone);

	@Select("select  a.ename,a.eid,b.* from t_emps a,t_ossstu b,t_classes c where b.ossstuid=#{ossstuid} and c.eid=a.eid and b.clzid=c.clzid")
	@ResultMap("com.jkoss.dao.stu.OssstuMapper.BaseResultMap2")
	Ossstu seletStuByOsid(@Param("ossstuid")int ossstuid);

	int updateByossstu(@Param("ossstu") Ossstu ossstu);

	
}